import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    //此项设置默认重定向到首页，暂定为homepage
    redirect:'/homepage',
    children:[
        //其他可变区域的子页面，UserView为人员管理页面，Homepage为首页，UserCenterView为个人中心页面
      {path: '/homepage', component: () => import('../views/homepage/HomepageView.vue')},
      {path: '/service', component: () => import('../views/service/ServiceView.vue')},
      {path: '/order', component: () => import('../views/order/OrderView.vue')},
      {path: '/popularScience', component: () => import('../views/encyclopedias/PopularScienceView.vue')},
      {path: '/law', component: () => import('../views/encyclopedias/LawView.vue')},
      {path: '/read', component: () => import('../views/encyclopedias/ReadView.vue')},
      {path: '/petCircleSquare', component: () => import('../views/petCircle/PetCircleSquareView.vue')},
      {path: '/myPetCircle', component: () => import('../views/petCircle/MyPetCircleView.vue')},
      {path: '/myProfile', component: () => import('../views/mine/UserCenterView.vue')},
      {path: '/myOrder', component: () => import('../views/mine/MyOrder.vue')},
      {path: '/myCollection', component: () => import('../views/mine/MyCollection.vue')},
      {path: '/userManage', component: () => import('../views/manage/UserManageView.vue')},
    ]
  },
    //注册页独立出来（不显示顶部导航栏）在右上角未登录时显示超链接跳转
  {path: '/register', component: () => import('../views/RegisterView')}
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router